package com.soft2018;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        // 创建玩家张三丰
        Player player = new Player(
                "张三丰",100,
                15,500,
                "凭空出现一个黑白太极鱼，印在对方胸口",
                "太极拳",1,1);
        player.print();

        Character monster = new Character(
                "元军小兵",100,
                 5,50,
                "一刀劈过来,",
                "力劈华山"
        );
        monster.print();

        player.attc(monster);
        monster.attc(player);

        player.skill_attc(monster);
        monster.skill_attc(player);

        //TODO: 构建二维数组，画地图
        Map[][] maps = new Map[2][2];
        maps[0][0] = new Map(0,0,"火焰山",
                "满眼都是红色沙漠，空气都已经扭曲变形，让人热得喘不过气。");
        maps[0][1] = new Map(1,0,"蓬莱",
                "蓝色波涛中，一个翠绿的海岛悬在空中，一只瑞兽在下方托起整个岛屿，漫天飞翔的都是凤凰。");
        maps[1][0] = new Map(0,1,"盘丝洞",
                "漆黑山洞中，闪耀着绿色点点鬼火，蜘蛛丝密布");
        maps[1][1] = new Map(1,1,"中土大唐",
                "车马如龙，好一片繁华景色");

        //TODO：输入方向，让玩家在地图中旅行

        //提示用户输入
        while (true) {
            System.out.println("你向往那个方向走？(e,w,n,s)");
            Scanner in = new Scanner(System.in);
            String direction = in.next();

            int x = 0, y = 0;
            switch (direction) {
                case "e":
                    x = player.getX() + 1;
                    y = player.getY();
                    player.travel(x, y);
                case "w":
                    x = player.getX() - 1;
                    y = player.getY();
                    player.travel(x, y);
                case "s":
                    x = player.getX();
                    y = player.getY() + 1;
                    player.travel(x, y);
                case "n":
                    x = player.getX();
                    y = player.getY() - 1;
                    player.travel(x, y);
                default:
                    Map m = maps[y][x];
                    m.print();
            }
        }

    }
}
